package com.order.common;


import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Slf4j
@Configuration
/*public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login");
    }

    @Bean
    public JwtInterceptor jwtInterceptor() {
        return new JwtInterceptor();
    }
}*/
public class InterceptorConfig extends WebMvcConfigurationSupport {

    @Override
    protected  void addInterceptors(InterceptorRegistry registry){

        registry.addInterceptor(jwtInterceptor())// 配置拦截器规则
                .addPathPatterns("/**")
                /*.excludePathPatterns("/desk_select")*/;// 拦截所有请求路径
        super.addInterceptors(registry);

    }
    @Bean
    public JwtInterceptor jwtInterceptor(){

        return new JwtInterceptor();
    }


}
